Skip to content

Capture upload to blob result and bubble up after completion in core#2615

Merged
ewertons merged 1 commit intomainfrom
ewertons/FixThreadedUploadToBlob
May 13, 2024
Merged

Capture upload to blob result and bubble up after completion in core#2615
ewertons merged 1 commit intomainfrom
ewertons/FixThreadedUploadToBlob

Conversation

@ewertons
Copy link
Copy Markdown
Contributor

@ewertons ewertons commented May 8, 2024

Checklist

  • I have read the [contribution guidelines] (https://github.com/Azure/azure-iot-sdk-c/blob/main/.github/CONTRIBUTING.md).
  • I added or modified the existing tests to cover the change (we do not allow our test coverage to go down).
  • If this is a modification that impacts the behavior of a public API
    • I edited the corresponding document in the devdoc folder and added or modified requirements.
  • I submitted this PR against the correct branch:
    • This pull-request is submitted against the main branch.
    • I have merged the latest main branch prior to submission and re-merged as needed after I took any feedback.
    • I have squashed my changes into one with a clear description of the change.

Reference/Link to the issue solved with this PR (if any)

#2569
#2614

Description of the problem

The upload to blob logic was re-written, and the code in the convenience layer (iothub_client_core.c) became faulty since it does not expose all possible errors or exposes duplicate result status.

Description of the solution

As described in #2569 ,
"Capture the last callback invocation from IoTHubClientCore_LL_UploadMultipleBlocksToBlob (uploadToBlobMultiblockCallbackWrapper) or IoTHubClientCore_LL_UploadMultipleBlocksToBlobEx (uploadToBlobMultiblockCallbackWrapperEx), no matter the result - name it blobStorageUploadResult
Save the result of the upload to blob API call (IoTHubClientCore_LL_UploadMultipleBlocksToBlob or IoTHubClientCore_LL_UploadMultipleBlocksToBlobEx) - name it result
In uploadMultipleBlock_thread, after the upload to blob API call, if result is IOTHUB_CLIENT_OK and blobStorageUploadResult is FILE_UPLOAD_OK, invoke threadInfo->uploadBlobMultiblockSavedData.getDataCallback (or Ex) with FILE_UPLOAD_OK. Otherwise invoke it with FILE_UPLOAD_ERROR
That way, for the convenience layer the final callback will always be called after the whole upload to blob logic is completed."

@ewertons ewertons merged commit 614cb35 into main May 13, 2024
@ewertons ewertons deleted the ewertons/FixThreadedUploadToBlob branch May 13, 2024 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants